<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "school_certificate".
 *
 * @property int $ID ID
 * @property int $XXID 学校ID
 * @property string $ZZLB 证照资质类别
 * @property string $ZZMC 证照资质名称
 * @property string $WJ 文件
 * @property string $HDSJ 获得时间
 * @property string $DJSJ 登记时间
 *
 * @property School $xX
 */
class SchoolCertificate extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'school_certificate';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['XXID', 'ZZLB', 'ZZMC', 'WJ', 'HDSJ', 'DJSJ'], 'required'],
            [['XXID'], 'integer'],
            [['HDSJ', 'DJSJ'], 'safe'],
            [['ZZLB'], 'string', 'max' => 20],
            [['ZZMC'], 'string', 'max' => 50],
            [['WJ'], 'string', 'max' => 100],
            [['XXID'], 'exist', 'skipOnError' => true, 'targetClass' => School::className(), 'targetAttribute' => ['XXID' => 'ID']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'ID' => 'ID',
            'XXID' => '学校ID',
            'ZZLB' => '证照资质类别',
            'ZZMC' => '证照资质名称',
            'WJ' => '文件',
            'HDSJ' => '获得时间',
            'DJSJ' => '登记时间',
        ];
    }

    /**
     * Gets query for [[XX]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getXX()
    {
        return $this->hasOne(School::className(), ['ID' => 'XXID'])->inverseOf('schoolCertificates');
    }
}
